<?php

namespace Modules\Common\Http\Controllers;

use App\Imports\UsersImport;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use App\Services\ExportExcelService;
use Modules\Base\Models\Material;
use PhpOffice\PhpSpreadsheet\IOFactory;


class ExcelController
{

    /**
     * Excel导出
     */
    public function export($option,Request $request){

        $enumClass = "\Modules\Common\Exports\\{$option}";
        if(!class_exists($enumClass)){
            throw new \Exception("导出类 {$option} 不存在");
        }
        return (new $enumClass)->export($request->all());

    }

    /**
     * Excel导入
     */
    public function import(){

    }

}
